import { hasRouteAuth } from '@/utils/permission';
import editBtn from './editBtn';

export default {
  components: {
    editBtn
  },
  props: {
    isNewVersion: {
      type: Boolean,
      default: false
    },
    isJournalPlatform: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    hasRouteAuth,
    editModule() {
      this.$emit('editModule');
    },
    handleField(fieldArr = []) { // 自定义字段处理
      const fields = JSON.parse(JSON.stringify(fieldArr));
      if (fields && fields.length > 0) {
        fields.forEach(el => {
          if (el.inputType === 1 || el.options) {
            const arr = el.options && el.options.filter(j => Number(el.value) === Number(j.value)) || [];
            if (arr.length > 0) {
              el.value = arr[0].label;
            }
          }
        });
      }
      return fields;
    }
  }
};
